package com.itheima.chapter01.array;

import java.util.Scanner;

/*
    数组元素求和
 */
public class demo3 {
    public static void main(String[] args) {
        int[] arr=new int[7];
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            Scanner sc =new Scanner(System.in);
            System.out.println("请输入数组中第"+(i+1)+"个数据");
            arr[i] = sc.nextInt();
        }
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        System.out.println("数组的和为："+sum);
    }
}
